package com.imooc.exception;

import com.imooc.enums.ErrorMsg;

/**
 * @author 逸尘风清
 * @date 2021/5/10
 * @time 11:09
 * 描述：
 */
public class CustomException extends RuntimeException {
    private final Integer code;
    private final String message;

    public CustomException(Integer code, String message){
        this.code = code;
        this.message = message;
    }

    public CustomException(ErrorMsg ex){
        this(ex.getCode(), ex.getMsg());
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
